package com.fire.market.service.impl.impl;


import com.fire.component.extension.Assert;
import com.fire.market.manager.ItemManager;
import com.fire.market.product.api.dto.ItemInfo;
import com.fire.market.product.api.result.ItemListResult;
import com.fire.market.service.impl.ItemQueryCoreService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ItemQueryCoreServiceImpl implements ItemQueryCoreService {
    @Resource
    private ItemManager itemManager;

    @Override
    public ItemListResult ListItem() {
        List<ItemInfo> itemInfoList = itemManager.selectAllItem();
        ItemListResult itemListResult = new ItemListResult();
        itemListResult.setListItem(itemInfoList);
        return itemListResult;
    }

    @Override
    public ItemInfo getItemDetail(Integer id) {
        Assert.notNull(id, "id is null");
        return itemManager.selectItemById(id);
    }
}
